from sklearn.ensemble import BaggingClassifier 
from sklearn.neighbors import KNeighborsClassifier
from sklearn.datasets import load_svmlight_file
bagging = BaggingClassifier(KNeighborsClassifier(),
				max_samples=0.5, max_features=0.5)
X_train, y_train = load_svmlight_file("/home/vishnu/Work/src/ft_ml/scikit/scripts/datasets/w4a")
X_test, y_test = load_svmlight_file("/home/vishnu/Work/src/ft_ml/scikit/scripts/datasets/w4a.t")
X_dense=X_train.toarray()
X_test_dense = X_test.toarray()
bagging.fit(X_dense,y_train)
print bagging.score(X_test_dense, y_test)
 
